package com.yth.extension;

import lombok.extern.slf4j.Slf4j;
import org.springframework.context.ApplicationContextInitializer;
import org.springframework.context.ConfigurableApplicationContext;

/**
 * <p>
 * 在Spring容器初始化前
 * </p>
 * <p>在最开始激活一些配置，或者利用这时候class还没被类加载器加载的时机，进行动态字节码注入等操作</p>
 *
 * <ol>
 *      <li>ApplicationContextInitializer::initialize                               </li>
 *      <li>create beanDefinition                                                   </li>
 *      <li>BeanDefinitionRegistryPostProcessor::postProcessBeanDefinitionRegistry  </li>
 *      <li>BeanFactoryPostProcessor::postProcessBeanFactory                        </li>
 *      <li>bean instantiation                                                      </li>
 *      <li>bean initialization                                                     </li>
 *      <li>SmartInitializingSingleton::afterSingletonsInstantiated                 </li>
 *      <li>CommandLineRunner::run                                                  </li>
 *      <li>bean destroy                                                            </li>
 * </ol>
 *
 * @author yutianhong
 * @version 1.0
 * @since 2023/08/29 13:56:10
 */
@Slf4j
public class TestApplicationContextInitializer implements ApplicationContextInitializer<ConfigurableApplicationContext> {
    @Override
    public void initialize(ConfigurableApplicationContext configurableApplicationContext) {
        // 在spring容器初始化之前进行操作
        log.info("[ApplicationContextInitializer::initialize]");
    }
}
